The invention relates generally to computer systems, and deals more particularly with an efficient channel and control unit program for a host computer, which channel and control unit program (and associated hardware) provides I/O service to a plurality of different external devices.
Most computers need to access one or more external devices such as disks or printers, and require some form of I/O service to manage the access. For example, an existing IBM System/370 computer includes a Block Multiplexor channel (comprising a processor and related program and other hardware) which provides the I/O service for a main processor. The Block Multiplexor channel relieves the main processor from the task of controlling I/O. The main processor need only initiate the Block Multiplexor channel, and the Block Multiplexor channel can directly access the main memory and transfer the data between the main memory and an I/O port of the System/370 computer. In conjunction with such a computer system, each external device also includes a control unit to manage the resources of the external device, i.e. directly access the resource and transfer the data between the resource and an I/O port of the external device. The two I/O ports are connected by a cable to complete the communication link. The channel can address a variety of different types of control units, and each control unit provides a device specific, managerial function.
Several steps are required to enable the System/370 computer to access the resource of the external device. Initially, an application program executing on the main processor requests read and write operations, and an associated operating system builds a channel program comprising channel command words (CCWS) or commands corresponding to the request. Then, the channel fetches the CCWs, and routes or "channels" the request or command to the appropriate control unit. Next, the control unit (1) validates the command to determine if it is a type that the control unit can handle, (2) determines the status of itself and the resource (busy or available), (3) reports the status to the channel, and if the control and resource are available, (4) validates the sequence in which the present command occurs, and if the sequence is valid (5) changes the status of the control unit and resource to busy, (6) requests the data from the channel in the case of a write command or requests attention by the channel in the case of a read operation, (7) initiates the associated hardware to perform the write or read operation, (8) returns a completion status to the channel and (9) changes the status of the control unit and resource to "available". These steps require frequent interplay between the channel and the control unit.
A later version of this System/370 computer system substitutes a single program which directly emulates the function of the Block Multiplexor channel and the function of each control unit. This program is executed by a multitasking operating system and provides one task to emulate the Block Multiplexor channel and another task to emulate each of the control units. Because these tasks directly emulate the Block Multiplexor channel and associated control units there is much interplay that requires many "context switches" between the channel task and each control unit task during the course of implementing a single read or write operation. A "context switch" occurs when one task stops executing on a processor and another task begins to execute on a processor. For each context switch, there is considerable overhead expended in recording where the one task stops executing and recording the contents of the associated registers and loading the registers for the other task. In the case of a write CCW within this computer system, context switches are required when the channel passes the CCW command to the control unit, the control unit passes initial status back to the channel, the channel signals an acceptance of the initial status to the control unit, the control unit requests data from the channel, and the control unit presents ending status to the channel. Also, considerable processor time is wasted by the channel task in waiting for the write or read operation to complete.
Accordingly, a general object of the present invention is to provide a single channel and control unit program which performs the foregoing channel and control unit functions but with reduced overhead and greater efficiency.